package org.cancan.demo;

import org.apache.commons.codec.digest.DigestUtils;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * @program: cancan-java-share
 * @description: 测试案例
 * @author: czchen
 * @date: 2023-03-02 10:10:15
 */
public class TestDemo {

    public static void main(String[] args) {
        try {
            String md5Hex1 = DigestUtils.md5Hex(new FileInputStream("C:\\Users\\cancan\\Pictures\\13305203237325898.jpg"));
            System.out.println("md5Hex1===="+md5Hex1);
            String md5Hex2 = DigestUtils.md5Hex(new FileInputStream("C:\\Users\\cancan\\Pictures\\13305203257597352.jpg"));
            System.out.println("md5Hex2===="+md5Hex2);
            if(md5Hex1.equals(md5Hex2)){
                System.out.println("相同");
            }else {
                System.out.println("不同");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
